import 'package:example/components/pool.dart';
import 'package:example/page/page_detail/page.dart';
import 'package:fish_redux/fish_redux.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart' hide Action, Page;

import '../../router/application.dart';
import '../base/state.dart';


Widget buildView(PageState state, Dispatch dispatch, ViewService viewService) {
  final List<Widget> children = [];
  for (String element in pool.keys) {
    children.add(viewService.buildComponent(element));
  }

  children.add(GestureDetector(
    onTap: () {
      Application.router.navigateTo(
          viewService.context, "/detail", transition: TransitionType.fadeIn).then((value) {
      });
    },
    child: Container(
      width: 200,
      height: 200,
      color: Colors.green,
      child: const Center(child: Text('goto Detail page', style: TextStyle(color: Colors.white),),),
    ),
  ));


  return Scaffold(
    appBar: AppBar(
      backgroundColor: Colors.blue,
      title: const Text('home_page'),
    ),
    body: Container(
      child: Column(
        children: children,
      ),
    ),
  );
}
